package com.jmlee.service.impl;

import com.jmlee.mapper.AItemSecKillMapper;
import com.jmlee.pojo.AItemSecKill;
import com.jmlee.service.AItemSecKillService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class AItemSecKillServiceImpl implements AItemSecKillService {

    @Autowired
    AItemSecKillMapper aItemSecKillMapper;

    @Override
    public List<AItemSecKill> getSecKillItemList(RowBounds rowBounds, AItemSecKill aItemSecKill) {
        if (rowBounds != null){
            return aItemSecKill != null ? this.aItemSecKillMapper.selectAItemSecKillList(rowBounds,aItemSecKill):this.aItemSecKillMapper.selectAItemSecKillList(rowBounds);
        }else{
            return aItemSecKill != null ? this.aItemSecKillMapper.selectAItemSecKillList(aItemSecKill) : this.aItemSecKillMapper.selectAItemSecKillList();
        }
    }

    @Override
    public Integer editSecKillItem(AItemSecKill aItemSecKill) {
        return aItemSecKillMapper.updateAItemSecKill(aItemSecKill);
    }

    @Override
    public Integer addSecKillItem(AItemSecKill aItemSecKill) {
        return aItemSecKillMapper.insertAItemSecKill(aItemSecKill);
    }

    @Override
    public Long getRecorderCount(AItemSecKill aItemSecKill) {
        return aItemSecKillMapper.selectRecordCount(aItemSecKill);
    }
}
